package runtime

import (
	"app/internal/model"
	"encoding/json"
	"fmt"

	"github.com/gin-gonic/gin"
)

func UserInfo(c *gin.Context) (supplier model.UserModel, err error) {
	str := c.GetString("userInfo")
	if len(str) == 0 {
		err = fmt.Errorf("获取登录信息失败")
		return
	}
	err = json.Unmarshal([]byte(str), &supplier)
	if err != nil {
		return
	}
	return
}
